
package com.value.util;

import java.lang.reflect.Field;

import javax.servlet.http.HttpServletRequest;

import com.value.model.FormBean;

public class FullBean {
	public static FormBean full(HttpServletRequest request,String formClass){
		Class clazz = null;
		FormBean fb=null;
		try {
			clazz = Class.forName(formClass);
			fb = (FormBean)clazz.newInstance();
			Field[] fields =clazz.getDeclaredFields();
			for(Field f :fields){
				f.setAccessible(true);
				f.set(fb, request.getParameter(f.getName()));
				f.setAccessible(false);
			}
		} catch (Exception e) {
			e.printStackTrace();
			System.out.println("封装javaBean报错..");
		}
		return fb;
	}

}
